<template>
  <div>
    <ul>
      <li
        v-for="i in 10"
        :key="i"
        @click="change(i)"
        :class="{ active: index == i }"
      >
        {{ i }}
      </li>
    </ul>
  </div>
</template>
<script>
import { ref } from "vue";
export default {
  setup(props) {
    const index = ref(-1);
    const change = (i) => {
      console.log(i);
      index.value = i;
    };
    return { change, index };
  },
};
</script>
<style lang="scss">
.active {
  background: #ccc;
}
</style>
